package com.fqgj.sentry.biz.mc.domain;

import com.fqgj.base.services.redis.RedisClient;
import com.fqgj.sentry.common.cache.RedisUserInfo;

/**
 * Created by ykpbean kangping.ying@yuntu-inc.com
 *
 * @description
 * @create 2017-07-14 上午10:14
 */


public class RedisOperate {

    public static void delRedisUserCache(RedisClient redisClient, Long userId) {
        String userCode = "riskLoginDataAdmin" + String.valueOf(userId);
        String token = redisClient.get(userCode);
        if (token == null) {
            return;
        }
        redisClient.del(userCode);
        redisClient.del(token);
        return;
    }

    public static void setRedisUserCache(RedisClient redisClient, Long userId, String token, RedisUserInfo redisUserInfo) {
        String userCode = "riskLoginDataAdmin" + String.valueOf(userId);
        redisClient.set(userCode, token);
        redisClient.set(token, redisUserInfo);
        return;
    }


}
